package com.dy.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dy.huang
 * @date 2020/5/10 23:54
 */
@RestController
@RequestMapping
public class KafkaController {
    @Autowired
    private KafkaTemplate kafkaTemplate;

    @GetMapping("/send")
    public Object send(String msg) {
        kafkaTemplate.send("test", "name", msg);
        return "send ok";
    }
}
